@import "variables";
@import "mixins";
@import "layout";

.ebooks img {
  padding: 5px;
}

#book-container {
  @extend .callout;
  position: relative;
  padding-top: 20px !important;
  padding-bottom: 20px !important;
  background-color: transparent !important;
  overflow: hidden;
  border: solid 1px lighten($base-border-color, 10%);
}

#book-intro {
  position: absolute;
  top: 40px;
  left: 50px;
  width: 200px;
  font-size: 13px;
  text-align: center;

  p {
    padding-bottom: 20px;
  }

  img.creative-commons {
    display: block;
    margin: 10px auto;
  }

  .license {
    font-size: 11px;
    line-height: 1.3;
    color: $light-font-color;
  }

  a#open-book {
    display: block;
    margin-top: 10px;
    margin-bottom: 10px;
    font-weight: bold;
  }
}

#about-book {
  @include background-image-2x($baseurl + "images/icons/info", 18px, 17px, 40px 1px);
  display: none;
  padding-left: 22px;
  font-size: 12px;
  color: $light-font-color;
  text-align: center;
  text-indent: 40px;

  &.visible {
    display: inline-block;
  }
}

ol.book-toc {
  @extend .unstyled !optional;
  margin: 30px 36px;

  li.chapter {
    margin-bottom: 0.6em;
  }

  ol {
    list-style: none;
  }

  h2 {
    color: $font-color;
  }

  a {
    padding-left: 4px;
  }
}

.book code {
  display: inline;
  padding: 1px;
}

.book pre code {
  display: block;
  overflow: auto;
}

.book table.ref {
  width: 100%;
  margin-bottom: 10px;
}

.book table.ref tr {
  border: 1px solid;
  border-color: #777;
}

.book table.ref th, td {
  padding: 5px;
}

.book table.ref th:nth-child(1),
.book td:nth-child(1) {
  width: 25%;
  padding: 5px;
}

#book-chapters {
  @extend .section-nav-container;

  #chapters-dropdown {
    top: 30px;
    padding: 12px;
  }

  ol {
    margin: 0;

    li {
      line-height: $base-line-height * 0.8;

      h2 {
        margin: 14px 0;
        font-size: 14px;
        line-height: normal;
      }

      ol {
        margin-left: 0;

        a {
          font-weight: normal;

          &.active {
            font-weight: bold;
            color: $orange;
          }
        }
      }
    }
  }
}

.switch a {
  color: #aaa;
}

.book-wrapper {
  float: right;
  margin: -20px 40px 0 40px;
}

@media (min-width: $mobile-m) {
  .book-toc {
    width: 60%
  }
  .book-wrapper {
    position: sticky;
    top: 2rem;
  }
}

@media (max-width: $mobile-xs) {
  .book-wrapper {
    margin-right: 0;
  }
}
